const router = require('koa-router')()
const util = require('../utils/util')
const { links, nodes } = require('../services/relation');

router.post('/getRelationData', async (ctx) => {
  try {
    const linksData = await links()
    const nodesData = await nodes()
    // console.log(newLink, newNode, 111111111111111);

    ctx.body = util.success({ linksData, nodesData })
    // ctx.body = util.success({ nodesData, linksData })
  } catch (error) {
    console.log(error);
    ctx.body = util.fail(error);
  }
})

module.exports = router